import sys


class Solution:
    def findMinArrowShots(self, points):
        """
        :type points: List[List[int]]
        :rtype: int
        """
        if len(points) == 0:
            return 0
        n = len(points)
        a = sorted(points, key=lambda x: x[1])
        curend = -sys.maxsize
        for i in range(len(a)):
            if curend >= a[i][0]:
                n -= 1
            else:
                curend = a[i][1]
        return n
